//
//  PlanDetailCell.m
//  DefendHealth
//
//  Created by 吾诺瀚卓 on 17/2/25.
//  Copyright © 2017年 iMacOne. All rights reserved.
//

#import "PlanDetailCell.h"
#import "Header.h"

@implementation PlanDetailCell
{
    UILabel * _titleLab;
    UILabel * _statusLab;
    UILabel * _contentLab;
    UIImageView * _img;
}
- (void)awakeFromNib {
    // Initialization code
}
-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    
    if (self) {
        self.contentView.backgroundColor = kWhiteColor;
        UILabel * slinelab =[[UILabel alloc]initWithFrame:CGRectMake(15, 0, 1, 30+13+8+10+11)];
        slinelab.backgroundColor = UIColorFromRGB(0xeaeae8);
        [self.contentView addSubview:slinelab];
        UILabel * titleLab = [ReduceCode creatLabelWithFrame:CGRectMake(35, 30, (kScreenWidth-35-10)/2, 13) title:@"" titleColor:UIColorFromRGB(0x231815) font:13 textAlignment:NSTextAlignmentLeft];
        [self.contentView addSubview:titleLab];
        UIImageView * img =[[UIImageView alloc]initWithFrame:CGRectMake(10, 0, 10, 10)];
        img.layer.masksToBounds = YES;
        img.layer.cornerRadius = 5;
        img.backgroundColor = UIColorFromRGB(0xd9d9d9);
        img.centerY=titleLab.centerY;
        [self.contentView addSubview:img];
        UILabel * statusLab = [ReduceCode creatLabelWithFrame:CGRectMake(kMaxX(titleLab.frame)+10, 30, (kScreenWidth-35-10)/2-10, 13) title:@"" titleColor:kBlackColor font:13 textAlignment:NSTextAlignmentRight];
        [self.contentView addSubview:statusLab];
        UILabel * contentLab = [ReduceCode creatLabelWithFrame:CGRectMake(35, kMaxY(titleLab.frame)+8, kScreenWidth-35-10, 10) title:@"" titleColor:kBlackColor font:10 textAlignment:NSTextAlignmentLeft];
        [self.contentView addSubview:contentLab];
        _titleLab = titleLab;
        _statusLab = statusLab;
        _contentLab = contentLab;
        _img = img;
    }
    
    return self;
}
-(void)setCellInfo:(NSDictionary *)dict{
    _titleLab.text = dict[@"title"];
    _statusLab.text = dict[@"status"];
    _contentLab.text = dict[@"content"];
    _titleLab.font = [UIFont fontWithName:@"ArialRoundedMTBold" size:13];
    if ([dict[@"status"] isEqualToString:@"完成"]) {
        _img.image = IMAGE(@"selected");
    }else{
        _img.image = IMAGE(@"not selected");
    }
    if ([dict[@"status"] isEqualToString:@"未开始"]) {
        _statusLab.textColor = UIColorFromRGB(0xeaeae8);
    }

}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
